﻿@if (IsLoading)
{
    <div class="modal" tabindex="-1" role="dialog" style="display:block; background-color: rgba(0,0,0,0.5);">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Loading...</h5>
                </div>
                <div class="modal-body">
                    <div class="text-center">
                        <div class="spinner-border" role="status">
                            <span class="sr-only"></span>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    SSBlack = true;
}
else
{

    @if (SSBlack)
    {
        <div class="fixed-top alert alert-light alert-dismissible fade show align-center" role="alert">
            <strong>转化成功!</strong>耗时 @SS 秒
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" @onclick="Hide"></button>
        </div>
    }
}
@code {
    [Parameter]
    public int SS { get; set; }
    [Parameter]
    public bool SSBlack { get; set; }
    [Parameter]
    public bool IsLoading { get; set; }
     protected override async Task OnParametersSetAsync()
    {
        if (SSBlack)
        {
            await Task.Delay(6000);
            SSBlack = false;
            StateHasChanged();
        }
    }
    public void Show() { IsLoading = true; StateHasChanged(); }

    public void Hide() { IsLoading = false; SSBlack = false; StateHasChanged(); }

}